﻿using FluentValidation.Results;
using MediatR;
using System;

namespace DncLite.Domain.Core.Commands
{
    /// <summary>
    /// 抽象命令基类
    /// </summary>
    public abstract class Command : IRequest
    {
        #region 属性
        /// <summary>
        /// 时间戳
        /// </summary>
        public DateTime Timestamp { get; set; }
        /// <summary>
        /// 验证结果
        /// </summary>
        public ValidationResult ValidationResult { get; set; }
        #endregion

        #region 方法
        public Command()
        {
            Timestamp = DateTime.Now;
        }

        /// <summary>
        /// 定义抽象方法,返回验证是否通过
        /// </summary>
        /// <returns></returns>
        public abstract bool IsValid();
        #endregion
    }
}
